<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .w100 button {
            width: 100px;
            height: 100px;
            background-color: gray;
            border: 1px solid black;
            color: white;
            margin: 10px 10px;

        }

        ul {
            list-style: none;
            width: 400px;
            height: 500px;
            display: flex;
            flex-wrap: wrap;
            flex-direction: row;
            justify-content: flex-start;

        }

        .w300 button {
            width: 340px;
            height: 100px;
            background-color: gray;
            border: 1px solid black;
            color: white;
            margin: 10px 10px;
        }
    </style>
</head>

<body>
    <input type="text" class="input">
    <ul onclick="fun()">
        <li class="w100">
            <button>7</button>
        </li>
        <li class="w100">
            <button>8</button>
        </li>
        <li class="w100">
            <button>9</button>
        </li>
        <li class="w100">
            <button>4</button>
        </li>
        <li class="w100">
            <button>5</button>
        </li>
        <li class="w100">
            <button>6</button>
        </li>
        <li class="w100">
            <button>1</button>
        </li>
        <li class="w100">
            <button>2</button>
        </li>
        <li class="w100">
            <button>3</button>
        </li>
        <li class="w300">
            <button>0</button>
        </li>
    </ul>
    <script>
        function fun() {
            let input = document.querySelector(".input");
            var obj = event.srcElement;
            input.value += obj.innerText;
        }
    </script>
</body>

</html>